package org.discala.samples.complex.mealmaker

import org.discala.samples.complex.domain.MealType.MealType
import org.discala.samples.complex.chef.Chef
import org.discala.samples.complex.recipegenerator.RecipeGenerator

/**
 * @author Chris Turner
 */
trait MealMakerComponent {

  this: AnyRef { val recipeGenerator: () => RecipeGenerator
                 val chef: () => Chef } =>

  val maker: () => MealMaker

  class DefaultMealMaker extends MealMaker {

    def makeMeal(mealType: MealType, ingredientCount: Int) = {
      val recipe = recipeGenerator().createRecipe(mealType, ingredientCount)
      chef().cookMeal(recipe)
    }
  }
}
